home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / utilit~1 / lack.zoo / sysvars.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  6.5 KB  |  179 lines

  1. /* definitions for various GEMDOS system variables in low memory */
  2. /* WARNING: this file is not compatible with the old one */
  3.  
  4. /*
  5.  * Convention:
  6.  *     the address for each variable is defined.
  7.  */
  8. #ifndef _SYSVARS_H
  9. #define _SYSVARS_H
  10.  
  11. #ifndef _COMPILER_H
  12. #include <compiler.h>
  13. #endif
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18.  
  19.  
  20. /* Processor state and post mortem dump area */
  21.  
  22. #define PROC_LIVES_MAGIC 0x12345678L    /* proc_lives if dump is valid */
  23. #define proc_lives    ((unsigned long *) 0x380L)
  24. struct __post_mortem_dump {
  25.     unsigned long    d0, d1, d2, d3, d4, d5, d6, d7;
  26.     void           *a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7; /* a7 == ssp */
  27.     void        *pc;      /* first byte is exception #   */
  28.     void        *usp;
  29.     unsigned short    stk[16];  /* sixteen word of super stack */
  30. };
  31. #define proc_post_mortem_dump_p    ((struct __post_mortem_dump *) 0x384L)
  32. #define proc_dregs    (&proc_post_mortem_dump_p->d0)
  33. #define proc_aregs    (&proc_post_mortem_dump_p->a0)
  34. #define proc_pc        (proc_post_mortem_dump_p->pc)
  35. #define proc_usp    (proc_post_mortem_dump_p->usp)
  36. #define proc_utk    (proc_post_mortem_dump_p->stk)
  37.  
  38.  
  39. /* timer, crit error and process termination handoff vectors */
  40. #define etv_timer    (((void (**)()) 0x400L))
  41. #define etv_critic    (((void (**)()) 0x404L))
  42. #define etv_term    (((void (**)()) 0x408L))
  43.  
  44. /* memory controller */
  45. #define MEMVALID_MAGIC    0x752019F3L    /* once memory is sized */
  46. #define memvalid    (((unsigned long *) 0x420L))
  47. #define mencntlr    (((unsigned char *) 0x424L))
  48.              /* 0 = 128K, 4 = 512K 0 = 256k(2banks) 5 = 1M */
  49.  
  50. /* reset vector, jump through resvector if resvalid on reset */
  51. #define RESVALID_MAGIC    0x31415926L
  52. #define resvalid    ((unsigned long *) 0x426L)
  53. #define resvector    ((void (**)())     0x42aL)
  54.             /* do a jmp 0x24L(a6) at end to go to system reset */
  55.  
  56. /* mem */
  57. #define phystop        (((char **) 0x42eL)) /* physical top of ram */
  58. #define _membot        (((char **) 0x432L)) /* bottom of avail     */
  59. #define _memtop        (((char **) 0x436L)) /* top    of avail     */
  60. #define MEMVAL2_MAGIC    0x237698AAL /* after suc. coldstart && memvalid     */
  61. #define MEMVAL3_MAGIC    0x5555AAAAL /* doesn't exist in tos 1.0, treated    */
  62.                     /* just like memval2 (i think)         */
  63. #define memval2        (((unsigned long *) 0x43AL))
  64. #define memval3        (((unsigned long *) 0x51AL)) 
  65.  
  66. /* floppy */
  67. #define flock        (((short *) 0x43eL)) /* lock usage of DMA   chip */
  68. #define seekrate    (((short *) 0x440L)) /* 0=6ms 1=12ms 2=2ms 3=3ms */
  69. #define _timr_ms    (((short *) 0x442L)) /* timer calib == 20ms      */
  70. #define _fverify    (((short *) 0x444L)) /* write verify flag        */
  71. #define _bootdev    (((short *) 0x446L))
  72.  
  73. /* video */
  74. #define palmode        (((short *) 0x448L)) /* PAL video mode flag         */
  75. #define defshiftmd    (((unsigned char *) 0x44aL)) /* default video rez   */
  76. #define sshiftmd    (((short *) 0x44cL)) /* shadow of hdwr. shiftmd reg */
  77.                           /* 0=Lo 1=med 2=Hi rez         */
  78. #define _v_bas_ad    (((void *) 0x44eL))  /* screen mem base             */
  79. #define vblsem        ((short *) 0x452L)   /* vbl semaphore               */
  80. #define nvbls        (((short *) 0x454L)) /* # of vbl entries def. == 8  */
  81. #define _vblqueue    (((void (***)()) 0x456L)) /* vbl queue pointer      */
  82. #define colorptr    (((short **) 0x45aL)) /* pal. on next vblank if !NULL */
  83. #define _vbclock    (((unsigned long *) 0x462L)) /* vbi counter         */
  84. #define _frclock        (((unsigned long *) 0x466L)) /* #vbi not vblsem'ed  */
  85.  
  86. #define _hz_200        ((unsigned long *) 0x4baL)
  87.  
  88. #define conterm        (*((char *) 0x484L))
  89. #define savptr        ((long *) 0x4A2L)
  90. #define _nflops        ((short *) 0x4A6L)
  91.  
  92. #define longframe   ((short *) 0x59eL)
  93.  
  94. /* hard disk */
  95.  
  96. #define _drvbit        ((long *) 0x4c2)      /* bitmap of live partictions    */
  97.             /* when I take D off line, icd promotes E to D */
  98. #define _buf1        (((_BCB *)[2]) 0x4b4) /* not bpb, buffer control block
  99.                            * 1st for data sectors,
  100.                            * 2nd for FATs and dirs           */
  101. #define _dskbufp    (*((char *) 0x4c6))   /* common!? disk buffer           */
  102.  
  103. /*typedef struct {
  104. /*    struct _BCB    *b_link;    /* next bcb          */
  105. /*    short    b_bufdrv;    /* drive # or -1 ?      */
  106. /*    short    b_buftyp;    /* ?              */
  107. /*    short    b_bufrec;    /* # of records          */
  108. /*    void    *b_dm;        /* drive media descripter  DMD * 
  109. /*                 * what the hell kind of type is that */
  110. /*    char    *b_bufr;    /* the buffer itself
  111. /*                 * is it me, or does the above imply more
  112. /*                 * than one present */
  113. /*} _BCB;*/
  114.  
  115. /* icdboot sets these:    */
  116. #define hdv_bpb        ((struct _BPB*(*)()) 0x472)    /* Getbpb  */
  117. #define hdv_rw        ((long(*)()) 0x476)        /* Rwabs   */
  118. #define hdv_mediach    ((long(*)()) 0x47e)        /* Mediach */
  119. /* but not these:    */
  120. #define hdv_init    ((void(*)()) 0x46a)    /* ?        */
  121. #define hdv_boot    ((void(*)()) 0x47a)    /* ?        */
  122.  
  123. typedef struct {
  124.   short    puns;
  125.   char    v_p_un[16];
  126.   long    pstart[16];
  127.   short    bpbs[1];        /* really 16 BPB's (bios parameter block) */
  128. } HDINFO;
  129.  
  130. #define pun_ptr        ((HDINFO *) 0x516L)
  131. #define _p_cookies    ((long **) 0x5A0L)
  132.  
  133. /* os setup */
  134. #define GEM_IS_VALID    0x87654321L    /* value of gem_mem->gemvalid    */
  135. typedef struct gem_mem
  136. {
  137.     long        gemvalid;    /* validates gem        */
  138.     void        *gem_end;    /* gem end of ram        */
  139.     char        *gem_exec;    /* gem exec_os            */
  140. } GEM_MEM;
  141.  
  142. typedef struct _osheader 
  143. {
  144.     unsigned short    os_entry;        /* 0x00  BRA to reset handler    */
  145.     unsigned short    os_version;      /* 0x02  TOS version        */
  146.     void        (*reseth) __PROTO((void)); /* 0x04 -> reset handler */
  147.     struct _osheader    *os_beg;     /* 0x08 -> base of OS        */
  148.     void        *os_end;     /* 0x0c -> end of OS ram usage */
  149.     char        *os_exec;     /* 0x10 starts as sysbase, execed after auto\ */
  150.     GEM_MEM        *os_magic;     /* 0x14 GEM memory usage param */
  151.     long        os_date;     /* 0x18 Build date 0xMMDDYYYY    */
  152.     unsigned short    os_conf;     /* 0x1c OS conf bits (country code) */
  153.     unsigned short    os_dosdate;     /* 0x1e DOS format build date  */
  154.     /* the following available on TOS version >= 1.2 */
  155.     char        **p_root;     /* 0x20 -> base of OS pool    */
  156.     char        **pkbshift;     /* 0x24 -> kbd shift state var */
  157.     char        **p_run;     /* 0x28 -> PID of current proc */
  158.     char        *p_rsv2;     /* 0x2c reserved        */
  159. } OSHEADER;
  160.  
  161. #define os_rsvr1    os_exec            /* ers official name    */
  162.     
  163. #define _sysbase    ((OSHEADER **) 0x4F2L)
  164. #define _shell_p    ((long *) 0x4F6L)
  165. #define end_os        ((void *) 0x4faL)    /* end of os ram usage         */
  166. #define exec_os        ((void (**)()) 0x4fe)    /* _sysbase, or gem startup code */
  167.  
  168. /* zzzz to-do more */
  169.  
  170. __EXTERN long    get_sysvar        __PROTO((void *var));
  171. __EXTERN void    set_sysvar_to_long    __PROTO((void *var, long val));
  172.  
  173.  
  174. #ifdef __cplusplus
  175. }
  176. #endif
  177.  
  178. #endif /* _SYSVARS_H */
  179.